import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const router = new Router({
    routes: [{
            path: '/',
            component: (resolve) => {
                require(['../views/Home'], resolve)
            }
        }, {
            path: '/news',
            name: 'News',
            component: (resolve) => {
                require(['../views/News'], resolve)
            }
        }, {
            path: '/newsdetails/:id',
            name: 'NewsDetails',
            component: (resolve) => {
                require(['../views/NewsDetails.vue'], resolve)
            }
        }, {
            path: '/product',
            name: 'Product',
            component: (resolve) => {
                require(['../views/Product'], resolve)
            }
        }, {
            path: '/case',
            name: 'Case',
            component: (resolve) => {
                require(['../views/Case.vue'], resolve)
            }
        }, {
            path: '/casedetails/:id',
            name: 'CaseDetails',
            component: (resolve) => {
                require(['../views/CaseDetails.vue'], resolve)
            }
        }, {
            path: '/about',
            name: 'About',
            component: (resolve) => {
                require(['../views/About.vue'], resolve)
            }
        }, {
            path: '/help',
            name: 'Help',
            component: (resolve) => {
                require(['../views/Help'], resolve)
            }
        }, {
            path: '/recruitment',
            name: 'Recruitment',
            component: (resolve) => {
                require(['../views/Recruitment'], resolve)
            }
        }, {
            path: '/message',
            name: 'Message',
            component: (resolve) => {
                require(['../views/Message.vue'], resolve)
            }
        }, {
            path: '/study',
            name: 'Study',
            component: (resolve) => {
                require(['../views/Study'], resolve)
            }
        },
        {
            path: '/appDownload',
            name: 'appDownload',
            component: (resolve) => {
                require(['../views/AppDownload'], resolve)
            }
        }
    ]
})

//  判断是否需要登录权限 以及是否登录
router.beforeEach((to, from, next) => {
        next()
})

export default router
